package hashmap;

import java.util.HashMap;
import java.util.Set;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : HashMapDemo
 * @Author : 54061
 * @Date: 2022/2/9 16:18
 */
public class HashMapDemo {
    public static void main(String[] args) {
        //创建集合对象
        HashMap<String,String> hm = new HashMap<>();
        System.out.println("hm = " + hm);

        //添加元素
        System.out.println("hm.put(\"奶量\",\"露露\") = " + hm.put("奶量","露露"));
        hm.put("pone","露露");
        hm.put("暴强","荣荣");
        hm.put("宇帆","白盒");
        System.out.println("hm.put(\"暴强\",\"小网红\") = " + hm.put("暴强","小网红"));
        System.out.println("hm = " + hm);

        //召集所有丈夫
        Set<String> keys = hm.keySet();
        for (String key : keys){
            //丈夫找媳妇
            String value = hm.get(key);
            System.out.println(key +"----"+value);
        }




    }
}
